using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class AbilityMode : MonoBehaviour
{
    private List<Ability> abilities;

    private void Start()
    {
        abilities = new List<Ability>();
    }
    public void AddAbility(Ability ability)
    {
        if(!abilities.Contains(ability))
        {
            abilities.Add(ability);
        }
    }
    public void OnKillEnemyAbility()
    {
        CallAbilities<Ability_KillEnemy>();
    }
    private void CallAbilities<T>() where T : Ability
    {
        foreach (var ability in abilities)
        {
            if (ability is T specificAbility)
            {
                specificAbility.Apply();
            }
        }
    }
}
